<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="姓名" id="t1">
<input type="text" placeholder="工资" id="t2">
<input type="text" placeholder="工作" id="t3">
<input type="button" value="添加" onclick="f()">
<table border="1">
  <caption>员工列表</caption>
  <tr>
    <th>姓名</th>
    <th>工资</th>
    <th>工作</th>
  </tr>
</table>
<script>
  let t1 = document.querySelector("#t1");
  let t2 = document.querySelector("#t2");
  let t3 = document.querySelector("#t3");
  function f(){
    let tr = document.createElement("tr")
    let nameTd = document.createElement("td");
    let salTd = document.createElement("td");
    let jobTd = document.createElement("td");
    //获取文本框内容赋值给td
    nameTd.innerText = t1.value;
    salTd.innerText = t2.value;
    jobTd.innerText = t3.value;
    //把3个td装进tr
    tr.append(nameTd,salTd,jobTd);
    //得到table,把tr装进table
    let table = document.querySelector("table");
    table.append(tr);
  }

</script>
</body>
</html>